package com.spring;

import com.sun.istack.internal.Nullable;

/**
 * 后置处理器
 *
 * @author ztranscript 2021/9/18 14:14
 */
public interface BeanPostProcessor {
    /**
     * bean 初始化前
     *
     * @param bean     bean
     * @param beanName beanName
     * @return bean
     * @throws Exception
     */
    @Nullable
    default Object postProcessBeforeInitialization(Object bean, String beanName) throws Exception {
        return bean;
    }

    /**
     * bean 初始化后
     *
     * @param bean     bean
     * @param beanName beanName
     * @return bean
     * @throws Exception
     */
    @Nullable
    default Object postProcessAfterInitialization(Object bean, String beanName) throws Exception {
        return bean;
    }
}
